package org.eclipse.stp.policy_builder.util;

import java.util.ArrayList;

import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.Platform;
import org.eclipse.stp.policy_builder.model.exceptions.DescriptorException;


public abstract class AbstractExtensionParser<Target> {
    protected String pluginID, extPoint ; 
	
	public IExtension[] getExtensions(String pluginID,String extPoint){
		return Platform.getExtensionRegistry().getExtensionPoint(
                pluginID, extPoint).getExtensions();
	}
	
    public abstract Object parseElement(IConfigurationElement element,Object[] args)throws DescriptorException;
	
    public abstract ArrayList<Target> run();
	
    protected void setPluginID(String pluginID){
    	this.pluginID = pluginID ;
    }
	
    protected void setExtPoint(String extPoint){
    	this.extPoint = extPoint ;
    }
    
    protected String  getExtPoint(){
    	return extPoint;
    }
    
    protected String  getPluginID(){
    	return pluginID;
    }
    
}
